from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get('https://www.baidu.com/')
driver.maximize_window()

case = driver.find_element(By.XPATH, "//a[contains(text(),'hao')]")
print(case.get_attribute('outerHTML'))

case = driver.find_element(By.XPATH, "//*[contains(@id,'kw')]")
print(case.get_attribute('outerHTML'))



driver.quit()
